package me.zhengjie.modules.system.repository;

import me.zhengjie.modules.system.domain.Requirement;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import java.util.List;

/**
 * RequirementRepository
 *
 * @author guoyuan
 * @version 1.0.0
 * @since 1.0.0
 */
public interface RequirementRepository extends JpaRepository<Requirement, String>, JpaSpecificationExecutor<Requirement> {
    /**
     * 根据需求编号倒序排列获取第一个
     *
     * @return /
     */
    Requirement findFirstByOrderByRequirementIdDesc();

    /**
     * 根据id列表查所有，根据需求编号正序排序
     *
     * @param ids /
     * @return /
     */
    List<Requirement> findAllByIdInOrderByRequirementIdAsc(List<String> ids);

    /**
     * 查找当前需求中大于当前需求编号的所有需求
     *
     * @param requirementId /
     * @return /
     */
    List<Requirement> findAllByRequirementIdGreaterThanOrderByRequirementIdAsc(Integer requirementId);

    /**
     * 查找当前需求中小于当前需求编号最大需求编号的需求
     *
     * @param requirementId /
     * @return /
     */
    Requirement findFirstByRequirementIdLessThanOrderByRequirementIdDesc(Integer requirementId);
}
